
var exec = require('child_process').execSync;

function execCmd(cmd) {
	exec(cmd, (error, stdout, stderr) => {
		if (error) {
			console.error(`exec error: ${error}`);
			return;
		}
	});
}

function sendAjax(url, param) {
	$("body").mLoading("show");
	$.ajax({
		type: "POST",
		url: url,
		data: param,
		success: function (msg) {
			$("#result").html(msg);
			$("body").mLoading("hide");
		}
	});
}

function bindButtonMethod(url) {
	$("button[method]").click(function () {
		var method = $(this).attr("method");
		var params = $(this).attr("params");
		var lastParams = "method=" + method;
		if (params) {
			lastParams = lastParams + "&" + params;
		}
		sendAjax(url, lastParams);
	});
}

/**
 * path
 */
var pathUtils = {
	//nw.exe运行地址  
	nwPath: require("path").dirname(process.execPath),
	//应用地址  
	appPath: process.cwd(),
	//配置文件地址
	getConfigPath: function () { return this.appPath + "/config.properties"; }

}














